package com.yswy.common.serializer;

import com.fasterxml.jackson.core.JsonGenerator;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.JsonSerializer;
import com.fasterxml.jackson.databind.SerializerProvider;
import org.joda.time.LocalDateTime;

import java.io.IOException;

public class CustomDateTimeSerializer extends JsonSerializer<LocalDateTime> {
    @Override  
    public void serialize(LocalDateTime value, JsonGenerator jgen, SerializerProvider provider)
            throws IOException, JsonProcessingException {
       jgen.writeString(value.toString("yyyy-MM-dd HH:mm:ss"));  
    }

}
